
//
//  YXPostModel.m
//  CreditCard
//
//  Created by 杨旭 on 2018/1/18.
//  Copyright © 2018年 杨旭. All rights reserved.
//

#import "YXPostModel.h"

@implementation YXPostModel


- (CGFloat)cellHeight {
    // 1.头像
    _cellHeight = 65;
    
    // 标题
    _cellHeight += 30;
    
    if ([self.type isEqualToString:@"0"]) { // 图文
        self.contentF = CGRectMake(0, _cellHeight, kScreenWidth, 100);
        _cellHeight += 100 + 10;
        
    }else if ([self.type isEqualToString:@"1"]) { // 视频
        self.contentF = CGRectMake(10, _cellHeight, kScreenWidth-20, 150);
        _cellHeight += 150 + 10;
    }else if ([self.type isEqualToString:@"2"]){
        // 文字
        CGSize textMaxSize = CGSizeMake(kScreenWidth - 20, MAXFLOAT);
        CGSize textSize = [self.contents boundingRectWithSize:textMaxSize options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15]} context:nil].size;
        self.contentF = CGRectMake(10,_cellHeight, kScreenWidth-20, textSize.height);
        _cellHeight += textSize.height + 10;
    }
    
    // 底部 - 工具条
    _cellHeight += 40 + 10;
        
    return _cellHeight;
}

@end
